function p(url, data = {}) {
    return new Promise((resolve, reject) => {
        $.ajax({
            type: 'get',
            url,
            data,
            dataType: "json",
            success: function (response) {
                resolve(response);
            },
            error(e) {
                reject(e);
            }
        });
    })
}
let songUrl = '';
let disstid = location.search.slice(1);
p(`http://47.97.121.9:3300/getSongListDetail?${disstid}`)
    .then(res => {
        let music = res.response.cdlist[0].songlist;
        // console.log(res.response.cdlist[0].songlist);
        player.musicList = music;
        var $musicList = $('.songlist_content');
        $.each(music, function (index, value) {
            $item = createMusicItem(index, value);
            $musicList.append($item);
        });
        initMusicInfo(music[0]);
        // initLyric(music[0]);
    })

// 定义一个方法创建一条音乐
function createMusicItem(index, music) {
    var $item = $(`
            <li class="songlist_list songlist_header">
                <div class="checkbox"><input type="checkbox" name="" id="all"></div>
                <div class="songlist_number">${index + 1}</div>
                <div class="songlist_header_name">
                    <a class="name">${music.name}</a>
                    <div class="menu">
                        <a href="javascript:;" class="list_menu_play" title="播放"><i
                                class="iconfont list_menu_icon_play"></i></a>
                        <a href="javascript:;" class="list_menu_add" title="添加到歌单"><i
                                class="iconfont list_menu_icon_add"></i></a>
                        <a href="javascript:;" class="list_menu_share" title="分享"><i
                                class="iconfont list_menu_icon_share"></i></a>
                    </div>
                </div>
                <div class="songlist_header_author">
                    <a href="javascript:;">${music.singer[0].name}</a>
                </div>
                <div class="songlist_header_time" href="javascript:;">
                    <a href="javascript:;">
                        <div class="songlist_time">03:24</div>
                        <i class="iconfont del"></i>
                    </a>
                </div>
            </li>
        `)
    $item[0].index = index;
    $item[0].music = music;
    return $item;
}

// 加载歌曲列表
// getPlayerList();
// function getPlayerList() {
//     $.ajax({
//         type: "get",
//         url: "/qqmusic/player/source/musiclist.json",
//         dataType: "json",
//         success: function (music) {
//         },
//         error(e) {
//             console.log(e);
//         }
//     });
// }